/*
 * Copyright (c) 2015 Apostolis Iakovakis, Nikos Karagiannis,
 * Nikos Krommydas & Malamas Malamidis. All rights reserved.
 *
 * This file is part of Rastaman.
 *
 * Rastaman is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.

 * Rastaman is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Rastaman.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
package eap.pli24.rastaman.ui;

import eap.pli24.rastaman.ui.skins.SkinProvider;
import java.awt.Dimension;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JLabel;

/**
 * Η κλάση {@code HeaderPanel} είναι ένα {@code JPanel} για την εμφάνιση
 * επικεφαλίδων στο παράθυρο της εφαρμογής.
 *
 * @author Apostolis Iakovakis
 * @author Nikos Karagiannis
 * @author Nikos Krommydas
 * @author Malamas Malamidis
 */
public class HeaderPanel extends javax.swing.JPanel {

    /**
     * Creates new form HeaderPanel
     */
    public HeaderPanel() {
        initComponents();
        initFurther();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        filler1 = new Box.Filler(new Dimension(15, 5), new Dimension(15, 5), new Dimension(15, 5));
        headerLabel = new JLabel();

        setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
        add(filler1);

        headerLabel.setPreferredSize(new Dimension(0, 30));
        add(headerLabel);
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private Box.Filler filler1;
    private JLabel headerLabel;
    // End of variables declaration//GEN-END:variables
    //
    // Ο δικός μας κώδικας αρχίζει εδώ, για να είναι
    // εμφανώς διαχωρισμένος από τον αυτόματα δημιουργούμενο
    //

    /**
     * Εμφανίζει το κείμενο {@code text} σαν επικεφαλίδα σε αυτό το
     * {@code HeaderPanel}.
     *
     * @param text το κείμενο της επικεφαλίδας
     */
    public void setHeaderLabel(String text) {
        headerLabel.setText(text);
    }

    /**
     * Αρχικοποίεί περαιτέρω στοιχεία του UI.
     */
    private void initFurther() {
        setPreferredSize(new Dimension(0, SkinProvider.getInstance().getSkin().getHeaderHeight()));
        setBackground(SkinProvider.getInstance().getSkin().getHeaderBackground());
        headerLabel.setFont(SkinProvider.getInstance().getSkin().getHeaderFont());
        headerLabel.setForeground(SkinProvider.getInstance().getSkin().getHeaderForeground());
    }
}
